// @ts-ignore
import playerPng from "res://assets/player.png";
import BaseSprite from "./base_sprite";
export default class PlayerSprite extends BaseSprite {
    constructor() {
        super();
        this.faceMap = {
            1: 3,
            2: 0,
            3: 1,
            4: 2,
        };
        this.hNum = 5;
        this.vNum = 4;
        this.xFrame = 0;
        this.yFrame = 0;
        this.texture = playerPng;
        this.position = new godot.Vector2(200, 200);
        this.set_hframes(this.hNum);
        this.set_vframes(this.vNum);
        this.set_frame_coords(new godot.Vector2(Math.floor(this.xFrame), this.yFrame));
        this.isInputMove = true;
    }
    _process(delta) {
        super._process(delta);
        // 播放动画
        if (this.face > 0) {
            let yFrame = this.faceMap[this.face];
            if (this.yFrame != yFrame) {
                this.xFrame = 0;
                this.yFrame = yFrame;
            }
            else {
                if (this.xFrame < this.hNum) {
                    this.xFrame = this.xFrame + 0.3;
                }
                else {
                    this.xFrame = 0;
                }
            }
        }
        this.xFrame = this.xFrame > 5 ? 0 : this.xFrame;
        this.set_frame_coords(new godot.Vector2(Math.floor(this.xFrame), this.yFrame));
    }
}
//# sourceMappingURL=player_sprite.jsx.map